﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Ict.DataAccess.Conditions
{
    /// <summary>
    /// SQL IN Clause条件
    /// </summary>
    [Serializable]
    public class InCond : Condition
    {
        private string _fieldName;
        /// <summary>
        /// 字段名
        /// </summary>
        public string FieldName
        {
            get
            {
                return _fieldName;
            }
        }

        private object[] _values;
        /// <summary>
        /// 值数组
        /// </summary>
        public object[] Values
        {
            get
            {
                return _values;
            }
        }

        /// <summary>
        /// 生成IN语句条件
        /// </summary>
        /// <param name="fieldName">字段名</param>
        /// <param name="values">数值数组</param>
        public InCond(string fieldName, params object[] values)
        {
            if (values.Length == 0)
                throw new Exception("No value is provided.");

            _fieldName = fieldName;
            _values = values;
        }

    }
}
